#include fast32.fi
#inpend=0
#short
var32 lines,tlines

on error
    {
    print bios
    error msg "\dos.err"
    print bios "!"
    terminate
    }
on break error 999

ld=allocate 4096
tlines=0

print bios "Files: ";
inputs name
print bios
if peekb (name+2)=0 then error 999

find first name+2
goto entry

forever
    {
    #errors off
    find next
    if error then goto dtotal
    #errors on
    entry:
    moveb 13 from dta segment|dta offset+30 to name
    curtoloc
    prints name,0
    open #1,name
    lines=0

    file_loop:
    len=read #1,65534 to ld|1
    m=1
    while m below len
	{
	m=searchb len-m from ld|m for 13
	if m then lines++ else goto getn
	m++
	}

    getn:
    if len=65534 then goto file_loop
    close #1
    print ,;:n32=lines:print32(' '):tlines+=lines
    loctocur:print bios
    test break
    }

dtotal:
print bios cr lf "Total Lines = ";
curtoloc
n32=tlines:print32(0)
terminate

name:
string 14
